package cloud.demo.eureka;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import cloud.demo.eureka.model.Product;
import cloud.demo.eureka.service.ProductService;

@RestController
@RequestMapping("/products")
public class ProductController {

	@Resource
	private ProductService service;

	@Value("${hello.msg}")
	private String msg;

	@RequestMapping(method = RequestMethod.GET)
	public List<Product> all() {
		return service.all();
	}

	@RequestMapping(value = "/info", method = RequestMethod.GET)
	public String info() {
		return msg;
	}
}
